Forum : using casting of object's
Brief description  about Online courses   join in Online courses
View vijay kumar thota 's Profile

using casting of object's

class Cars
{
void cars()
{
System.out.println("THERE ARE TEN PEOPLE HAVING CARS IN A STREET");
}
void bikes()
{
System.out.println("THERE ARE TWENTY PEOPLE HAVING MOTORCYCLES IN A STREET");
}
}

class Carnbike extends Cars
{
void carnbike()
{
System.out.println("THERE ARE EIGHT PEOPLE HAVING CARS AND MOTORCYCLES IN A STREET");
}
}

public class Castingexample
{
public static void main(String [] args)
{
//Object obj=new Carnbike();
//Carnbike C=(Carnbike)obj;
Carnbike obj=new Carnbike();
obj.cars();
obj.bikes();
obj.carnbike();
}
}

can u plz. tell me how type casting can be done in the above program.
Asked by vijay kumar thota | Aug 26, 2010 |  Reply now
Replies (1)
View arun kumar das 's Profile
Please mention if you want to do implicit or explicit casting.
Sep 24, 2010